<?php


//Route::get('/', function () {
//    return view('welcome');
//});

Route::get('/', 'LoginController@loginPage')->name('login');
Route::post('/login', 'LoginController@login');
Route::get('/register', 'LoginController@registerPage');
Route::post('/register', 'LoginController@register');
Route::get('/logout', 'LoginController@logout');



Route::middleware('auth:student', 'throttle:60,1')->group(function () {
    Route::get('/student', 'student\IndexController@index');
    Route::get('/student/class/{class_id}', 'student\ClassController@index');
    Route::post('/student/class/{class_id}/sendmessage', 'student\ClassController@sendMessage');
    Route::get('/student/class/{class_id}/work', 'student\ClassController@workPage');
    Route::get('/student/class/{class_id}/attendance', 'student\ClassController@attendancePage');
    Route::post('/student/addclass', 'student\ClassController@addClass');
    Route::post('/student/exitclass', 'student\ClassController@exitClass');
    Route::post('/student/verifycode', 'student\ClassController@verifyCode');
    Route::post('/student/uploadwork', 'student\ClassController@uploadWork');
    Route::post('/student/viewwork', 'student\ClassController@viewWork');
    Route::get('/student', 'student\IndexController@index');


});
Route::middleware('auth:teacher', 'throttle:60,1')->group(function () {
    Route::get('/teacher', 'teacher\ClassController@index');
    Route::get('/teacher/class/{class_id}/work', 'teacher\ClassController@workPage');
    Route::get('/teacher/class/{class_id}/attendance', 'teacher\ClassController@attendancePage');
    Route::get('/teacher/class/{class_id}/message', 'teacher\ClassController@messagesPage');
    Route::get('/teacher/class/{class_id}/message/{student_id}', 'teacher\ClassController@messagePage');
    Route::post('/teacher/class/{class_id}/sendmessage', 'teacher\ClassController@sendMessage');
    Route::post('/teacher/class/{class_id}/work/{work_id}/check', 'teacher\ClassController@checkWork');
    Route::post('/teacher/stopattendance', 'teacher\ClassController@stopAttendance');
    Route::post('/teacher/startattendance', 'teacher\ClassController@startAttendance');
    Route::post('/teacher/class/{class_id}/work/create', 'teacher\ClassController@createWork');
    Route::post('/teacher/class/create', 'teacher\ClassController@createClass');
});


